﻿using System;
using System.Collections.Generic;
using System.Collections;
using System.IO;
using System.Threading;
using System.Text;
using System.Net;
using UnityEngine;
using HtmlAgilityPack;

public class ArtistInfo
{
    static public String artscrollBaseHost = "http://www.artscroll.ru";
    static public String artscrollPageAlias = "/page.php?al=";
    static public String artscrollPageID = "/page.php?id=";

    public String rawStringInfo { get; set; }

    public String artistName { get; set; }
    public String artistAliases { get; set; }
    public String pageAlias { get; set; }
    public String pageID { get; set; }

    public String fullAliasLink { get; set; }
    public String fullIDlink { get; set; }

    public List<String> linksToImages = new List<String>();
    public bool linkToImagesCache = false;
    public List<ImageInfo> images = new List<ImageInfo>();
    public List<bool> imagesDone;
    public List<bool> imagesCache = new List<bool>();

    public Texture2D tex2d;

    public void MakeFullLinks()
    {
        fullAliasLink = artscrollBaseHost + artscrollPageAlias + pageAlias;
        fullIDlink = artscrollBaseHost + artscrollPageAlias + pageAlias;
    }
    public void ParseRawStringInfo()
    {
        var info = rawStringInfo.Split(';');
        artistName = info[0];
        artistAliases = info[1];
        pageAlias = info[2];
        pageID = info[3];
    }

    public ArtistInfo()
    {
        artistName = null;
        artistAliases = null;
        pageAlias = null;
        pageID = null;

        this.MakeFullLinks();
    }
    public ArtistInfo(String artistName, String artistAliases, String pageAlias, String pageID)
    {
        this.artistName = artistName;
        this.artistAliases = artistAliases;
        this.pageAlias = pageAlias;
        this.pageID = pageID;

        this.MakeFullLinks();
    }
    public ArtistInfo(String rawStringInfo)
    {
        this.rawStringInfo = rawStringInfo;
        this.ParseRawStringInfo();
        this.MakeFullLinks();
    }
}
